@import '../../style/themes/index';
@import '../../style/mixins/index';
@import '../../input/style/mixin';

@cascader-prefix-cls: ~'@{vcu-prefix}-cascader';

.@{cascader-prefix-cls} {
  .reset-component;

  &-input.@{vcu-prefix}-input {
    position        : static;
    width           : 100%;
    padding-right   : 24px;
    // because input.less will compile after cascader.less
    background-color: transparent !important;
    cursor          : pointer;
  }

  &-picker-show-search &-input.@{vcu-prefix}-input {
    position: relative;
  }

  &-picker {
    .reset-component;

    position        : relative;
    display         : inline-block;
    background-color: @component-background;
    border-radius   : @border-radius-base;
    outline         : 0;
    cursor          : pointer;
    transition      : color 0.3s;

    &-large {
      font-size: @font-size-lg;
    }

    &-small {
      font-size: @font-size-sm;
    }

    &-mini {
      font-size: @font-size-mini;
    }

    &-with-value &-label {
      color: transparent;
    }

    &-disabled {
      color     : @disabled-color;
      background: @input-disabled-bg;
      cursor    : not-allowed;

      .@{cascader-prefix-cls}-input {
        cursor: not-allowed;
      }
    }

    &:focus .@{cascader-prefix-cls}-input {
      .active;
    }

    &-show-search&-focused {
      color: @disabled-color;
    }

    &-label {
      position     : absolute;
      top          : 50%;
      left         : 0;
      width        : 100%;
      height       : 20px;
      margin-top   : -10px;
      padding      : 0 20px 0 @control-padding-horizontal;
      overflow     : hidden;
      line-height  : 20px;
      white-space  : nowrap;
      text-overflow: ellipsis;
    }

    &-clear {
      position   : absolute;
      top        : 50%;
      right      : @control-padding-horizontal;
      z-index    : 2;
      width      : 12px;
      height     : 12px;
      margin-top : -6px;
      color      : @disabled-color;
      font-size  : @font-size-sm;
      line-height: 12px;
      background : @component-background;
      cursor     : pointer;
      opacity    : 0;
      transition : color 0.3s ease, opacity 0.15s ease;

      &:hover {
        color: @text-color-secondary;
      }
    }

    &:hover &-clear {
      opacity: 1;
    }

    // arrow
    &-arrow {
      position   : absolute;
      top        : 50%;
      right      : @control-padding-horizontal;
      z-index    : 1;
      width      : 12px;
      height     : 12px;
      margin-top : -6px;
      color      : @disabled-color;
      font-size  : 12px;
      line-height: 12px;
      transition : transform 0.2s;

      &&-expand {
        transform: rotate(180deg);
      }
    }

  }

  &-picker-label:hover+&-input {
    .hover;
  }

  &-picker-small &-picker-clear,
  &-picker-small &-picker-arrow {
    right: @control-padding-horizontal-sm;
  }

  &-menus {
    position     : absolute;
    z-index      : @zindex-dropdown;
    font-size    : @cascader-dropdown-font-size;
    white-space  : nowrap;
    background   : @component-background;
    border-radius: @border-radius-base;
    box-shadow   : @box-shadow-base;

    ul,
    ol {
      margin    : 0;
      list-style: none;
    }

    &-empty,
    &-hidden {
      display: none;
    }

    &.slide-up-enter.slide-up-enter-active&-placement-bottomLeft,
    &.slide-up-appear.slide-up-appear-active&-placement-bottomLeft {
      animation-name: vcuSlideUpIn;
    }

    &.slide-up-enter.slide-up-enter-active&-placement-topLeft,
    &.slide-up-appear.slide-up-appear-active&-placement-topLeft {
      animation-name: vcuSlideDownIn;
    }

    &.slide-up-leave.slide-up-leave-active&-placement-bottomLeft {
      animation-name: vcuSlideUpOut;
    }

    &.slide-up-leave.slide-up-leave-active&-placement-topLeft {
      animation-name: vcuSlideDownOut;
    }
  }

  &-menu {
    display           : inline-block;
    min-width         : 111px;
    height            : 180px;
    margin            : 0;
    padding           : @cascader-dropdown-edge-child-vertical-padding 0;
    overflow          : auto;
    vertical-align    : top;
    list-style        : none;
    border-right      : @border-width-base @border-style-base @border-color-split;
    -ms-overflow-style: -ms-autohiding-scrollbar;

    &:first-child {
      border-radius: @border-radius-base 0 0 @border-radius-base;
    }

    &:last-child {
      margin-right      : -1px;
      border-right-color: transparent;
      border-radius     : 0 @border-radius-base @border-radius-base 0;
    }

    &:only-child {
      border-radius: @border-radius-base;
    }
  }

  &-menu-item {
    padding    : @cascader-dropdown-vertical-padding @control-padding-horizontal;
    line-height: @cascader-dropdown-line-height;
    white-space: nowrap;
    cursor     : pointer;
    transition : all 0.3s;

    &:hover {
      background: @item-hover-bg;
    }

    &-disabled {
      color : @disabled-color;
      cursor: not-allowed;

      &:hover {
        background: transparent;
      }
    }

    &-active:not(&-disabled) {

      &,
      &:hover {
        font-weight     : @select-item-selected-font-weight;
        background-color: @background-color-light;
      }
    }

    &-expand {
      position     : relative;
      padding-right: 24px;
    }

    &-expand &-expand-icon,
    &-loading-icon {
      .iconfont-size-under-12px(10px);

      position: absolute;
      right   : @control-padding-horizontal;
      color   : @text-color-secondary;

      .@{cascader-prefix-cls}-menu-item-disabled& {
        color: @disabled-color;
      }
    }

    & &-keyword {
      color: @highlight-color;
    }
  }
}